home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / hdf / unix / hdf3_2r2.lha / HDF3.2r2 / src / herr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-28  |  8.9 KB  |  199 lines

  1. /*
  2. $Header: /hdf/hdf/v3.2r2/src/RCS/herr.h,v 1.1 1992/08/25 21:40:44 koziol beta koziol $
  3.  
  4. $Log: herr.h,v $
  5.  * Revision 1.1  1992/08/25  21:40:44  koziol
  6.  * Initial revision
  7.  *
  8. */
  9. /*+ herr.h
  10. ***  header file for using error routines
  11. *** to be included by all ".c" files
  12. +*/
  13.  
  14. #ifndef HERROR
  15.  
  16. /* if these symbols are not provided by the compiler, we'll have to
  17.    fake them.  These are used in HERROR for recording location of
  18.    error in code. */
  19.  
  20. #ifndef __FILE__
  21. #   define __FILE__ "File name not supported"
  22. #endif
  23. #ifndef __LINE__
  24. #   define __LINE__ 0
  25. #endif
  26.  
  27. /* HERROR macro, used to facilitate error reporting.  Assumes that
  28.    there's a variable called FUNC which holds the function name.
  29.    Assume that func and file are both stored in static space, or at
  30.    least be not corrupted in the meanwhile. */
  31.  
  32. #define HERROR(e) HEpush((int16)(e), FUNC, __FILE__, __LINE__)
  33.  
  34. /* HRETURN_ERROR macro, used to facilitate error reporting.  Makes
  35.    same assumptions as HERROR.  IN ADDITION, this macro causes
  36.    a return from the calling routine */
  37.  
  38. #define HRETURN_ERROR(err, ret_val) {HERROR(err); return(ret_val);}
  39.  
  40.  
  41. /* Clear the error stack */
  42. extern int32 error_top;
  43. #define HEclear() { error_top = (int32)0; }
  44.  
  45. /*
  46. ======================================================================
  47.    Error codes
  48.  
  49.    NOTE: Remember to update the error_messages[] structure in herr.c
  50.    whenever errors are added/deleted from this list.
  51. ======================================================================
  52. */
  53. #define DFE_NONE        0   /* special zero, no error */
  54. #define DFE_FNF         -1  /* File not found */
  55. #define DFE_DENIED      -2  /* Access to file denied */
  56. #define DFE_ALROPEN     -3  /* File already open */
  57. #define DFE_TOOMANY     -4  /* Too Many DF's or files open */
  58. #define DFE_BADNAME     -5  /* Bad file name on open */
  59. #define DFE_BADACC      -6  /* Bad file access mode */
  60. #define DFE_BADOPEN     -7  /* Other open error */
  61. #define DFE_NOTOPEN     -8  /* File can't be closed 'cause it isn't open */
  62. #define DFE_CANTCLOSE   -9  /* fclose wouldn't work! */
  63. #define DFE_DFNULL      -10 /* DF is a null pointer */
  64. #define DFE_ILLTYPE     -11 /* DF has an illegal type: internal error */
  65.  
  66. #define DFE_UNSUPPORTED -12 /* Feature not currently supported */
  67.  
  68. #define DFE_BADDDLIST   -13 /* The DD list is non-existent: internal error */
  69. #define DFE_NOTDFFILE   -14 /* This is not a DF file and it is not 0 length */
  70. #define DFE_SEEDTWICE   -15 /* The DD list already seeded: internal error */
  71. #define DFE_NOSPACE     -16 /* Malloc failed */
  72. #define DFE_NOSUCHTAG   -17 /* No such tag in the file: search failed */
  73. #define DFE_READERROR   -18 /* There was a read error */
  74. #define DFE_WRITEERROR  -19 /* There was a write error */
  75. #define DFE_SEEKERROR   -20 /* There was a seek error */
  76. #define DFE_NOFREEDD    -21 /* There are no free DD's left: internal error */
  77. #define DFE_BADTAG      -22 /* illegal WILDCARD tag */
  78. #define DFE_BADREF      -23 /* illegal WILDCARD reference # */
  79. #define DFE_RDONLY      -24 /* The DF is read only */
  80. #define DFE_BADCALL     -25 /* Calls in wrong order */
  81. #define DFE_BADPTR      -26 /* NULL ptr argument */
  82. #define DFE_BADLEN      -27 /* Invalid len specified */
  83. #define DFE_BADSEEK     -28 /* Attempt to seek past end of element */
  84. #define DFE_NOMATCH     -29 /* No (more) DDs which match specified tag/ref */
  85. #define DFE_NOTINSET    -30 /* Warning: Set contained unknown tag: ignored */
  86. #define DFE_BADDIM      -31 /* negative or zero dimensions specified */
  87. #define DFE_BADOFFSET   -32 /* Illegal offset specified */
  88. #define DFE_BADSCHEME   -33 /* Unknown compression scheme specified */
  89. #define DFE_NODIM       -34 /* No dimension record associated with image */
  90. #define DFE_NOTENOUGH   -35 /* space provided insufficient for size of data */
  91. #define DFE_NOVALS      -36 /* Values not available */
  92. #define DFE_CORRUPT     -37 /* File is corrupted */
  93. #define DFE_BADFP       -38 /* File contained an illegal floating point num */
  94. #define DFE_NOREF       -39 /* no more reference numbers are available */
  95. #define DFE_BADDATATYPE -40 /* unknown or unavailable data type specified */
  96. #define DFE_BADMCTYPE   -41 /* unknown or unavailable machine type specified */
  97. #define DFE_BADNUMTYPE  -42 /* unknown or unavailable number type specified */
  98. #define DFE_BADORDER    -43 /* unknown or illegal array order specified */
  99. #define DFE_ARGS        -44 /* bad arguments to routine */
  100. #define DFE_INTERNAL    -45 /* serious internal error */
  101. #define DFE_DUPDD       -46 /* the new tag/ref is already used */
  102. #define DFE_CANTMOD     -47 /* old element not exist, cannot modify */
  103. #define DFE_RANGE       -48 /* improper range for attempted acess */
  104. #define DFE_BADTABLE    -49 /* the nsdg table is wrong   */
  105. #define DFE_BADSDG      -50 /* error processing an sdg    */
  106. #define DFE_BADNDG      -51 /* error processing an ndg     */
  107. #define DFE_BADFIELDS   -52 /* Bad fields string passed to Vset routine */
  108. #define DFE_NORESET     -53 /* Too late to modify this value */
  109. #define DFE_NOVS        -54 /* Counldn't find VS in file */
  110. #define DFE_VGSIZE      -55 /* Too many elements in VGroup */
  111. #define DFE_DIFFFILES   -56 /* Attempt to merge objs in diff files */
  112. #define DFE_VTAB        -57 /* Elmt not in vtab[] */
  113. #define DFE_BADAID      -58 /* Got a bogus aid */
  114. #define DFE_OPENAID     -59 /* There are still active AIDs */
  115. #define DFE_BADCONV     -60 /* Don't know how to convert data type */
  116. #define DFE_GENAPP    -61 /* Generic application-level error */
  117.  
  118. #ifdef _H_ERR_MASTER_
  119.  
  120. /* error_messages is the list of error messages in the system, kept as
  121.    error_code-message pairs.  To look up a message, a linear search is
  122.    required but efficiency should be okay. */
  123.  
  124. typedef struct error_messages_t {
  125.     int16 error_code;
  126.     char *str;
  127. } error_messages_t;
  128.  
  129. PRIVATE struct error_messages_t error_messages[] =
  130. {
  131. { DFE_NONE,        "No error"},
  132. { DFE_FNF,         "File not found"},
  133. { DFE_DENIED,      "Access to file denied"},
  134. { DFE_ALROPEN,     "File already open"},
  135. { DFE_TOOMANY,     "Too Many DF's or files open"},
  136. { DFE_BADNAME,     "Bad file name on open"},
  137. { DFE_BADACC,      "Bad file access mode"},
  138. { DFE_BADOPEN,     "Error opening file"},
  139. { DFE_NOTOPEN,     "File can't be closed; It isn't open"},
  140. { DFE_CANTCLOSE,   "Unable to close file"},
  141. { DFE_DFNULL,      "DF has a null pointer"},
  142. { DFE_ILLTYPE,     "Internal error: DF has an illegal type"},
  143.  
  144. { DFE_UNSUPPORTED, "Feature not currently supported"},
  145.  
  146. { DFE_BADDDLIST,   "Internal error: The DD list is non-existent"},
  147. { DFE_NOTDFFILE,   "This is not an HDF file"},
  148. { DFE_SEEDTWICE,   "Internal error: The DD list is already seeded"},
  149. { DFE_NOSPACE,     "Internal error: Out of space"},
  150. { DFE_READERROR,   "Read error"},
  151. { DFE_WRITEERROR,  "Write error"},
  152. { DFE_SEEKERROR,   "Error performing seek operation"},
  153. { DFE_NOFREEDD,    "There are no free DD's left"},
  154. { DFE_BADTAG,      "Illegal WILDCARD tag"},
  155. { DFE_BADREF,      "Illegal WILDCARD reference"},
  156. { DFE_RDONLY,      "Attempt to write to read-only HDF file"},
  157. { DFE_BADCALL,     "Calls in wrong order"},
  158. { DFE_BADPTR,      "NULL ptr argument"},
  159. { DFE_BADLEN,      "Invalid length specified"},
  160. { DFE_BADSEEK,     "Attempt to seek past end of element"},
  161. { DFE_NOMATCH,     "No (more) DDs which match specified tag/ref"},
  162. { DFE_NOTINSET,    "Set contained unknown tag: ignored"},
  163. { DFE_BADDIM,      "Negative or zero dimensions specified"},
  164. { DFE_BADOFFSET,   "Illegal offset specified"},
  165. { DFE_BADSCHEME,   "Unknown compression scheme specified"},
  166. { DFE_NODIM,       "No dimension record associated with image"},
  167. { DFE_NOTENOUGH,   "Space provided insufficient for size of data"},
  168. { DFE_NOVALS,      "Values not available"},
  169. { DFE_CORRUPT,     "File is corrupted"},
  170. { DFE_BADFP,       "File contained an illegal floating point number"},
  171. { DFE_NOREF,       "No more reference numbers are available"},
  172. { DFE_BADDATATYPE, "Unknown or unavailable data type specified"},
  173. { DFE_BADMCTYPE,   "Unknown or unavailable machine type specified"},
  174. { DFE_BADNUMTYPE,  "Unknown or unavailable number type specified"},
  175. { DFE_BADORDER,    "Unknown or illegal array order specified"},
  176. { DFE_ARGS,        "Invalid arguments to routine"},
  177. { DFE_INTERNAL,    "HDF Internal error"},
  178. { DFE_DUPDD,       "Tag/ref is already used"},
  179. { DFE_CANTMOD,     "Old element does not exist, cannot modify"},
  180. { DFE_RANGE,       "Improper range for attempted access"},
  181. { DFE_BADTABLE,    "The nsdg table is wrong"},
  182. { DFE_BADSDG,      "Error processing an sdg"},
  183. { DFE_BADNDG,      "Error processing an ndg"},
  184. { DFE_BADFIELDS,   "Unable to parse fields string correctly"},
  185. { DFE_NORESET,     "Can not reset this value"},
  186. { DFE_NOVS,        "Could not find specified VS or VG in file"},
  187. { DFE_VGSIZE,      "No more elements will fit in this VGroup"},
  188. { DFE_DIFFFILES,   "Attempt to merge objects in different files"},
  189. { DFE_VTAB,        "Element is not in VSet tables"},
  190. { DFE_BADAID,      "Unable to create a new AID"},
  191. { DFE_OPENAID,     "There are still active AIDs"},
  192. { DFE_BADCONV,     "Don't know how to convert data type"},
  193. { DFE_GENAPP,      "Generic application-level error"}
  194. };
  195. #endif /* _H_ERR_MASTER_ */
  196.  
  197. #endif /* HERROR */
  198.  
  199.